﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using NormActiveRecord;

namespace Kazuku.Core.Models {
	public class DynamicTemplate : ActiveRecordEntity<DynamicTemplate> {
		public string OrgCode { get; set; }
		public string Name { get; set; }
		public string Body { get; set; }

		public DynamicTemplate(IModelFactory modelFactory) : base(modelFactory) { }

		public string GetViewPath() {
			return GetViewPath(OrgCode, Name);
		}

		public static string GetViewName(string orgCode, string templateName) {
			return orgCode + "_" + templateName.Trim().Replace(" ", "");
		}

		public static string GetViewPath(string orgCode, string templateName) {
			return "/Views/Shared/" + GetViewName(orgCode, templateName) + ".aspx";
		}
	}
}
